package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	fileName := "advance/fileIO/testFiles/test02.txt"
	file, err := os.OpenFile(fileName, os.O_CREATE|os.O_RDWR, 0666)
	if err != nil {
		fmt.Println("error")
	}
	str := "hello\n"
	writer := bufio.NewWriter(file)
	for i := 0; i < 5; i++ {
		_, _ = writer.WriteString(str)
	}
	_ = writer.Flush()
	defer file.Close()

}
